#include "Result.h"
#include "Task.h"

void Result::bindTask() {
  if (task_) {
    task_->setResult(shared_from_this());
  }
}

std::shared_ptr<Result> Result::make_Result(std::shared_ptr<Task> task,
                                            bool isValid) {
  auto result = std::shared_ptr<Result>(new Result(std::move(task), isValid));
  result->bindTask();
  return result;
}